Public Class report
    Inherits System.Web.UI.Page
    Protected WithEvents DG_CUST As System.Web.UI.WebControls.DataGrid
    Protected WithEvents HyperLink1 As System.Web.UI.WebControls.HyperLink
    Protected WithEvents HyperLink2 As System.Web.UI.WebControls.HyperLink
    Protected WithEvents Image1 As System.Web.UI.WebControls.Image
    Protected WithEvents Image2 As System.Web.UI.WebControls.Image
    Protected WithEvents Label1 As System.Web.UI.WebControls.Label

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Public Sub bindGrid()
        Dim ds As New myDBConn()
        Dim SQL As String
        SQL = " SELECT ca.custcode ccode,cc.ccname cname FROM CUSTOMER_ALL CA,CCONTACT_ALL CC"
        SQL = SQL & "  WHERE NOT EXISTS (SELECT * FROM CONTRACT_ALL CO WHERE CO.CUSTOMER_ID=CA.CUSTOMER_ID)"
        SQL = SQL & "  AND  CC.CUSTOMER_ID=CA.CUSTOMER_ID "
        SQL = SQL & "  AND CC.CCBILL='X'"
        SQL = SQL & "  AND CA.CUSTOMER_ID_HIGH in (SELECT CA2.CUSTOMER_ID FROM CUSTOMER_ALL CA2 WHERE  CSLEVEL=20)"
        Me.DG_CUST.DataSource = ds.myORATable(SQL)
        Me.DG_CUST.DataBind()
    End Sub


    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here

        Dim sql1 As String
        Dim usr As String
        Dim ds As New myDBConn()
        Session.LCID = 1055

        If Page.IsPostBack Then Exit Sub
        usr = Request.ServerVariables("LOGON_USER")
        sql1 = "SELECT a.name FROM USERS a,perms p WHERE  a.usrid=p.usrid and a.LOGUSR= '" & usr & "' and appid=2;"

        If ds.myOleDbTable(sql1).Rows.Count > 0 Then

        Else
            Response.Redirect("logout.htm")
        End If
        bindGrid()
    End Sub

    Private Sub DG_CUST_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles DG_CUST.PageIndexChanged
        Me.DG_CUST.CurrentPageIndex = e.NewPageIndex
        bindGrid()

    End Sub
End Class
